#include <stdint.h>
#include "thermistor.h"
//#include "common.h"


#define	TEMPERATURE_INTERVAL	1 

// NTC-10K-II
const int32_t Therm_10K_II[]=
{
	//-30.000f,	100.000f,	5.000f,
	176683,	130243,	96970,	//-40~-20
	72895,	55298,	42315,	32651,	25395,	//-15~5
	19903,	15714,	12494,	10000,	8056,		//10~30
	6530,		5325,		4367,		3601,		2985,		//35~55
	2487,		2082,		1752,		1480,		1256,		//60~80
	1071,		916,		787,		679,					//85~100
};

// NTC-10K-III
const int32_t Therm_5K_B3324[]=
{
	//-40.000f,	110.000f,	1.000f,		//Min, Max, Resolution
	
	889100,	842400,	798500,	757200,	718400,	//-40~-36
	681900,	647500,	615100,	584600,	555800,
	528700,	502600,	478000,	454800,	432800,	//-30~-26
	412100,	392600,	374100,	356600,	340100,
	324400,	309300,	295100,	281600,	268800,	//-20~-16
	256600,	245200,	234300,	223900,	214100,
	204800,	195900,	187400,	179300,	171600,	//-10~-6
	164300,	157400,	150800,	144600,	138600,	
	132900,	127400,	122200,	117300,	112500,	//0~4
	108000,	103700,	99600,	95690,	91960,
	88400,	84960,	81670,	78530,	75530,	//10~14
	72670,	69930,	67310,	64810,	62420,
	60130,	57930,	55810,	53970,	51850,	//20~24
	50000,	48210,	46500,	44870,	43290,
	41790,	40330,	38940,	37600,	36310,	//30~34
	35080,	33900,	32760,	31670,	30620,
	29610,	28640,	27700,	26790,	25930,	//40~44
	25090,	24290,	23520,	22770,	22060,
	21370,	20700,	20060,	19430,	18840,	//50~54
	18260,	17700,	17170,	16650,	16150,
	15670,	15210,	14760,	14330,	13910,	//60~64
	13500,	13110,	12740,	12370,	12020,
	11690,	11350,	11040,	10730,	10430,	//70~74
	10140,	9861,	9592,	9331,	9079,
	8835,	8598,	8368,	8146,	7930,	//80~84
	7722,	7520,	7323,	7134,	6950,
	6771,	6599,	6432,	6270,	6113,	//90~94
	5961,	5813,	5670,	5531,	5396,
	5265,	5135,	5010,	4888,	4769,	//100~104
	4654,	4543,	4435,	4330,	4227,
	4128,																						//110
};

// Honeywell NTC-20K 
const int32_t Therm_10K_B3950[]=
{
	-3000,		10000,		1000,

};

const int32_t Therm_50K_B3950[]=
{
	//-30.000f,	120.000f,	1.000f,		//Min, Max, Resolution
	
	8479,	7982,	7517,	7082,	6674,	//-30~-26
	6293,	5935,	5600,	5286,	4991,
	4715,	4455,	4211,	3982,	3767,	//-20~-16
	3564,	3374,	3194,	3026,	2867,
	2717,	2576,	2443,	2318,	2200,	//-10~-6
	2088,	1983,	1884,	1790,	1701,	
	1617,	1538,	1463,	1392,	1325,	//0~4
	1262,	1202,	1145,	1091,	1040,		
	99140,	94550,	90200,	86060,	82140,	//10~14
	78420,	74880,	71530,	68340,	65310,
	62420,	59690,	57080,	54600,	52240,	//20~24
	50000,	47860,	45830,	43890,	42050,
	40290,	38610,	37010,	35490,	34030,	//30~34
	32650,	31320,	30060,	28850,	27700,
	26600,	25550,	24540,	23580,	22670,	//40~44
	21790,	20950,	20150,	19380,	18640,
	17940,	17270,	16620,	16000,	15410,	//50~54
	14850,	14300,	13780,	13280,	12800,
	12340,	11900,	11480,	11070,	10690,	//60~64
	10310,	9953,	  9608,	  9277,	  8959,
	8653,	8359,	8077,	7805,	7544,	//70~74
	7293,	7051,	6819,	6595,	6380,
	6173,	5973,	5781,	5596,	5418,	//80~84
	5246,	5080,	4921,	4767,	4619,
	4476,	4338,	4205,	4077,	3953,	//90~94
	3833,	3718,	3607,	3499,	3395,
	3295,	3198,	3105,	3014,	2927,	//100~104
	2842,	2760,	2681,	2605,	2531,
	2460,	2390,	2323,	2259,	2196,	//110~114
	2135,	2076,	2019,	1964,	1911,
	1859,
};

const int32_t Therm_5K_A501440[]=
{
	//-30.000f,	110.000f,	1.000f,		//Min, Max, Resolution
	
	636300,603200,572000,542700,515000,
  488900,464300,441100,419100,398400,
  378900,360300,342900,326400,310800,
  296000,282000,268800,256200,244400,
  233000,222400,212300,202600,193600,
  184900,176600,168800,161500,154400,
  147700,141300,135300,129500,124000,
  118700,113800,109100,104600,100200,	
  96140,92230,88500,84950,81550,
  78310,75210,72260,69430,66730,
  64160,61690,59340,57080,54930,
  52860,50890,49000,47190,45460,
  43790,42210,40680,39210,37820,
  36470,35180,33950,32760,31610,
  30520,29480,28460,27500,26560,
  25670,24810,23980,23190,22430,
  21690,20980,20300,19640,19010,
  18400,17820,17260,16720,16190,
  15680,15200,14730,14280,13840,
  13420,13020,12630,12250,11880,
  11530,11190,10870,10540,10240,	
  9944,9661,9386,9118,8860,
  8611,8370,8136,7910,7692,
  7481,7276,7078,6886,6701,
  6521,6346,6178,6015,5856,
  5703,5555,5410,5271,5135,
  5004,4876,4753,4633,4517,
  4404,4295,4188,4085,3985,
  3888,
};

const int32_t Therm_5K_A501436[]=
{
	//-30.000f,	105.000f,	1.000f,		//Min, Max, Resolution
  646300,612700,581000,551200,523100,
  496600,471600,448000,425700,404700,
  384800,366000,348300,331500,315700,
  300600,286400,273000,260200,248200,
  236700,225900,215600,205800,196600,
  187800,179400,171500,164000,156800,
  150000,143500,137400,131500,125900,
  120600,115600,110800,106200,101800,	
  97650,93680,89890,86280,82830,
  79540,76390,73390,70520,67780,
  65170,62660,60270,57980,55790,
  53690,51690,49770,47930,46170,
  44480,42870,41320,39830,38410,
  37040,35730,34480,33270,32110,
  31000,29940,28910,27930,26980,
  26070,25200,24360,23550,22780,
  22030,21310,20620,19950,19310,
  18690,18100,17530,16980,16440,
  15930,15440,14960,14500,14060,	
  13630,13220,12830,12440,12070,
  11710,11370,11040,10710,10400,
  10100,9813,9533,9261,8999,
  8746,8501,8264,8034,7813,
  7598,7390,7189,6994,6806,
  6623,6446,6275,6109,5948,
  5793,5642,5495,5354,5216,
  5083,4953,4828,4706,4588,
  4473,
};

//const int32_t Therm_50K_B3970[]=
//{
//		
//1025000	,	961700	,	902800	,	848100	,	797200	,
//749800	,	705500	,	664300	,	625700	,	589600	,
//555900	,	524200	,	494500	,	466800	,	440800	,
//416400	,	393400	,	371900	,	351600	,	332700	,
//314900	,	298100	,	282300	,	267400	,	253500	,
//240300	,	227900	,	216200	,	205200	,	194800	,
//185000	,	175700	,	166900	,	158700	,	150800	,
//143500	,	136500	,	129900	,	123600	,	117700	,
//112100	,	106900	,	101800	,	97090	,	92590	,
//88340	,	84300	,	80460	,	76830	,	73380	,
//70110	,	66990	,	64030	,	61230	,	58560	,
//56030	,	53610	,	51320	,	49130	,	47050	,
//45080	,	43180	,	41390	,	39680	,	38050	,
//36500	,	35010	,	33590	,	32240	,	30960	,
//29740	,	28550	,	27430	,	26360	,	25330	,
//24360	,	23430	,	22530	,	21670	,	20860	,
//20070	,	19320	,	18600	,	17920	,	17260	,
//16630	,	16030	,	15440	,	14880	,	14360	,
//13850	,	13360	,	12890	,	12430	,	12000	,
//11590	,	11190	,	10800	,	10440	,	10080	,
//9743	,	9416	,	9101	,	8799	,	8508	,
//8228	,	7959	,	7700	,	7450	,	7211	,
//6981	,	6758	,	6544	,	6337	,	6138	,
//5946	,	5761	,	5583	,	5411	,	5246	,
//5086	,	4932	,	4783	,	4639	,	4501	,
//4367	,	4237	,	4113	,	3992	,	3876	,
//3764	,	3656	,	3551	,	3449	,	3351	,
//3256	,	3164	,	3075	,	2990	,	2906	,
//2826	,	2748	,	2672	,	2601	,	2530	,
//2461	,	2395	,	2331	,	2269	,	2209	,
//2151	,	2094	,	2039	,	1986	,	1934	,
//1885	,	1836	,	1790	,	1744	,	1700	,
//1657	,	1615	,	1575	,	1536	,	1498	,
//1461	,	1426	,	1390	,	1356	,	1324	,
//1292	,	1262	,	1231	,	1201	,	1174	,
//1145	,	1119	,	1092	,	1067	,	1042	,
//1018									

//};


static  int32_t Therm_50K_B3970[]=
{
		
1025000	,	961700	,	902800	,	848100	,	797200	,
749800	,	705500	,	664300	,	625700	,	589600	,
555900	,	524200	,	494500	,	466800	,	440800	,
416400	,	393400	,	371900	,	351600	,	332700	,
314900	,	298100	,	282300	,	267400	,	253500	,
240300	,	227900	,	216200	,	205200	,	194800	,
185000	,	175700	,	166900	,	158700	,	150800	,
143500	,	136500	,	129900	,	123600	,	117700	,
112100	,	106900	,	101800	,	97090	,	92590	,
88340	,	84300	,	80460	,	76830	,	73380	,
70110	,	66990	,	64030	,	61230	,	58560	,
56030	,	53610	,	51320	,	49130	,	47050	, //25,26,27
45080	,	43180	,	41390	,	39680	,	38050	,
36500	,	35010	,	33590	,	32240	,	30960	,
29740	,	28550	,	27430	,	26360	,	25330	,
24360	,	23430	,	22530	,	21670	,	20860	,
20070	,	19320	,	18600	,	17920	,	17260	,
16630	,	16030	,	15440	,	14880	,	14360	,
13850	,	13360	,	12890	,	12430	,	12000	,
11590	,	11190	,	10800	,	10440	,	10080	,
9743	,	9416	,	9101	,	8799	,	8508	,
8228	,	7959	,	7700	,	7450	,	7211	,
6981	,	6758	,	6544	,	6337	,	6138	,
5946	,	5761	,	5583	,	5411	,	5246	,
5086	,	4932	,	4783	,	4639	,	4501	,
4367	,	4237	,	4113	,	3992	,	3876	,
3764	,	3656	,	3551	,	3449	,	3351	,
3256	,	3164	,	3075	,	2990	,	2906	,
2826	,	2748	,	2672	,	2601	,	2530	,
2461	,	2395	,	2331	,	2269	,	2209	,
2151	,	2094	,	2039	,	1986	,	1934	,
1885	,	1836	,	1790	,	1744	,	1700	,
1657	,	1615	,	1575	,	1536	,	1498	,
1461	,	1426	,	1390	,	1356	,	1324	,
1292	,	1262	,	1231	,	1201	,	1174	,
1145	,	1119	,	1092	,	1067	,	1042	,
1018	,								

};

//-40~105
static  int32_t Therm_15K_B3450[]=
{
	2040000, 1918000, 1805000, 1699000, 1600000,
	1507000, 1420000, 1339000, 1263000, 1192000,
	1125000, 1063000, 1004000, 949100,	897400,
	848800,	803200,	760300,	720000,	682000,
	646300,	612700,	581000,	551200,	523100,
	496600,	471600,	448000,	425700,	404700,
	384800,	366000,	348300,	331500,	315700,
	300600,	286400,	273000,	260200,	248200,
	236700,	225900,	215600,	205800,	196600,
	187800,	179400,	171500,	164000,	156800,
	150000,	143500,	137400,	131500,	125900,
	120600,	115600,	110800,	106200,	101800,	97650,	93680,
	89890,		86280,		82830,		79540,		76390,
	73390,		70520,		67780,		65170,		62660,
	60270,		57980,		55790,		53690,		51690,
	49770,		47930,		46170,		44480,		42870,
	41320,		39830,		38410,		37040,		35730,
	34480,		33270,		32110,		31000,		29940,
	28910,		27930,		26980,		26070,		25200,
	24360,		23550,		22780,		22030,		21310,
	20620,		19950,		19310,		18690,		18100,
	17530,		16980,		16440,		15930,		15440,
	14960,		14500,		14060,		13630,		13220,
	12830,		12440,		12070,		11710,		11370,
	11040,		10710,		10400,		10100,		9813,		9533,
	9261,		9000,		8750,		8500,		8260,
	8034,		7813,		7598,		7390,		7189,
	6990,		6810,		6620,		6450,		6280,
	6109,		5948,		5793,		5642,		5495,
	5354,		5216,		5083,		4953,		4828,
	4706,		4588,		4473		
};

//static float  test[5];
//int16_t Therm_GetTemperature_NTC_Table(uint32_t kohm, const int32_t *res_tbl)
//{
//	float max;
//	int32_t min,resolution;
//	uint16_t i,points;
//	float ret_value= 0;
//	
//	min= res_tbl[0];
//	max= res_tbl[1];
//	resolution= res_tbl[2];
//	
//	points= (max - min)/resolution;
//	test[0] = kohm;
//	resolution = resolution/10000;
//	min = min/10000;
//	if(kohm >= res_tbl[3])
//	{
//		ret_value= min;
//	}
//	else
//	{
//		if(kohm <= res_tbl[points + 3])
//		{
//			ret_value= max;
//		}
//		else
//		{
//			for(i= 0; i< points; i++)
//			{
//				if(kohm <= res_tbl[i + 3] && kohm > res_tbl[i + 4])
//				{
//					test[0] = kohm - res_tbl[i + 4];
//					test[1] = res_tbl[i + 3] - res_tbl[i + 4];
//					test[2]= test[0]/test[1];//(kohm - res_tbl[i + 4])/(res_tbl[i + 3] - res_tbl[i + 4]);
//					
//					test[3]= (-1)*test[2];
//					//ret_value= (-1)*(kohm - res_tbl[i + 4])/(res_tbl[i + 3] - res_tbl[i + 4]);
//					//test[3] = ret_value;
//					//resolution= resolution/(float)1000;
//					//ret_value = test[3];
//					test[4]*= resolution;
//					//test[2] = ret_value;
//					//min = min/(float)10000;
//					//test[4] = min;
//					//ret_value+= min + (i + 1)*resolution;
//					test[4]+= min + (i + 1)*resolution;
//					//test[4] = ret_value;
//					break;
//				}
//			}
//		}
//	}
//	
//	return (int16_t)ret_value;
//}





static int16_t SensorOhmsToTemperature_5K_B3324(int32_t Ohms) {
	uint8_t i;
	int16_t ScaledValue;
	float diff, span, InterpolatedValue;
	
	 
	if(Ohms >= Therm_5K_B3324[0])
	{
			ScaledValue = TEMP_MIN_5K_B3324;
	}
	else if(Ohms <= Therm_5K_B3324[150])
	{
			ScaledValue = TEMP_MAX_5K_B3324;
	}
	else
	{

				for (i = 0; i < 151; i++) //-200 ~ 850
				{
					if (Therm_5K_B3324[150 - i] > Ohms) {
						
						span = Therm_5K_B3324[150 - i] - Therm_5K_B3324[150 - (i - 1)];			
						diff = ((Ohms) - (Therm_5K_B3324[150 - (i - 1)]));			
						diff= span-diff;
						InterpolatedValue = (diff / span) * TEMPERATURE_INTERVAL;			
						InterpolatedValue *= 10; //Keeps  decimal places
						ScaledValue = (-400 + (10 * (150 - i))); //decimal places			
						ScaledValue = (ScaledValue) + (int16_t) InterpolatedValue;	
						break;
					}
				}
 }
	
	return ScaledValue;

}









static int16_t SensorOhmsToTemperature_50K_B3950(int32_t Ohms) {
	uint8_t i;
	int16_t ScaledValue;
	float diff, span, InterpolatedValue;
	
	 
	if(Ohms >= Therm_50K_B3950[0])
	{
			ScaledValue = TEMP_MIN_50K_B3950;
	}
	else if(Ohms <= Therm_50K_B3950[150])
	{
			ScaledValue = TEMP_MAX_50K_B3950;
	}
	else
	{

				for (i = 0; i < 151; i++) //-200 ~ 850
				{
					if (Therm_50K_B3950[150 - i] > Ohms) {
						
						span = Therm_50K_B3950[150 - i] - Therm_50K_B3950[150 - (i - 1)];			
						diff = ((Ohms) - (Therm_50K_B3950[150 - (i - 1)]));			
						diff= span-diff;
						InterpolatedValue = (diff / span) * TEMPERATURE_INTERVAL;			
						InterpolatedValue *= 10; //Keeps  decimal places
						ScaledValue = (-300 + (10 * (150 - i))); //decimal places			
						ScaledValue = (ScaledValue) + (int16_t) InterpolatedValue;	
						break;
					}
				}
 }
	
	return ScaledValue;

}




int32_t ttt[10];

static int16_t SensorOhmsToTemperature_5K_A501440(int32_t Ohms) {
	uint8_t i;
	int16_t ScaledValue;
	float diff, span, InterpolatedValue;
	
	 
	if(Ohms >= Therm_5K_A501440[0])
	{
			ScaledValue = TEMP_MIN_5K_A501440;
	}
	else if(Ohms <= Therm_5K_A501440[140])
	{
			ScaledValue = TEMP_MAX_5K_A501440;
	}
	else
	{

				for (i = 0; i < 141; i++) //-200 ~ 850
				{
					if (Therm_5K_A501440[140 - i] > Ohms) {
						
						ttt[0] = i;
						span = Therm_5K_A501440[140 - i] - Therm_5K_A501440[140 - (i - 1)];			
						diff = ((Ohms) - (Therm_5K_A501440[140 - (i - 1)]));			
						diff= span-diff;
						InterpolatedValue = (diff / span) * TEMPERATURE_INTERVAL;			
						InterpolatedValue *= 10; //Keeps  decimal places
						ttt[4] = InterpolatedValue;
						ScaledValue = (-300 + (10 * (140 - i))); //decimal places	
						ttt[5] = InterpolatedValue;						
						ScaledValue = (ScaledValue) + (int16_t) InterpolatedValue;	
						ttt[6] = ScaledValue;	
						break;
					}
				}
 }
	
	return ScaledValue;

}

static int16_t SensorOhmsToTemperature_5K_A501436(int32_t Ohms) {
	uint8_t i;
	int16_t ScaledValue;
	float diff, span, InterpolatedValue;
	
	 
	if(Ohms >= Therm_5K_A501436[0])
	{
			ScaledValue = TEMP_MIN_5K_A501436;
	}
	else if(Ohms <= Therm_5K_A501436[135])
	{
			ScaledValue = TEMP_MAX_5K_A501436;
	}
	else
	{

				for (i = 0; i < 136; i++) //-200 ~ 850
				{
					if (Therm_5K_A501436[135 - i] > Ohms) {
						
						span = Therm_5K_A501436[135 - i] - Therm_5K_A501436[135 - (i - 1)];			
						diff = ((Ohms) - (Therm_5K_A501436[135 - (i - 1)]));			
						diff= span-diff;
						InterpolatedValue = (diff / span) * TEMPERATURE_INTERVAL;			
						InterpolatedValue *= 10; //Keeps  decimal places
						ScaledValue = (-300 + (10 * (135 - i))); //decimal places			
						ScaledValue = (ScaledValue) + (int16_t) InterpolatedValue;	
						break;
					}
				}
 }
	
	return ScaledValue;

}

static int16_t SensorOhmsToTemperature_15K_B3450(int32_t Ohms) {
	uint8_t i;
	int16_t ScaledValue;
	float diff, span, InterpolatedValue;
	
	 
	if(Ohms >= Therm_15K_B3450[0])
	{
			ScaledValue = TEMP_MIN_15K_B3450;
	}
	else if(Ohms <= Therm_15K_B3450[150])
	{
			ScaledValue = TEMP_MAX_15K_B3450;
	}
	else
	{

				for (i = 0; i < 151; i++)
				{
					if (Therm_15K_B3450[150 - i] > Ohms) {
						
						span = Therm_15K_B3450[150 - i] - Therm_15K_B3450[150 - (i - 1)];			
						diff = ((Ohms) - (Therm_15K_B3450[150 - (i - 1)]));			
						diff= span-diff;
						InterpolatedValue = (diff / span) * TEMPERATURE_INTERVAL;			
						InterpolatedValue *= 10; //Keeps  decimal places
						ScaledValue = (-500 + (10 * (150 - i))); //decimal places			
						ScaledValue = (ScaledValue) + (int16_t) InterpolatedValue;	
						break;
					}
				}
 }
	
	return ScaledValue;

}


static int16_t SensorOhmsToTemperature_50K_B3970(int32_t Ohms) {
	uint8_t i;
	int16_t ScaledValue;
	float diff, span, InterpolatedValue;
	
	if(Ohms >= Therm_50K_B3970[0])
	{
			ScaledValue = TEMP_MIN_50K_B3970;
	}
	else if(Ohms <= Therm_50K_B3970[180])
	{
			ScaledValue = TEMP_MAX_50K_B3970;
	}
	else
	{
		
					for (i = 0; i < 181; i++) //-200 ~ 850
					{
						if (Therm_50K_B3970[180 - i] > Ohms) {
							//ttt[0] = i;
							span = Therm_50K_B3970[180 - i] - Therm_50K_B3970[180 - (i - 1)];
							//ttt[1] = span;
							diff = ((Ohms) - (Therm_50K_B3970[180 - (i - 1)]));
							//ttt[2] = diff;
							diff= span-diff;
							InterpolatedValue = (diff / span) * TEMPERATURE_INTERVAL;
						//	ttt[3] = InterpolatedValue;
							//tempvalue = InterpolatedValue;
							InterpolatedValue *= 10; //Keeps  decimal places
							//tempvalue = InterpolatedValue;
							//ttt[4] = InterpolatedValue;
							ScaledValue = (-300 + (10 * (180 - i))); //decimal places
							//ttt[5] = ScaledValue;
							ScaledValue = (ScaledValue) + (int16_t) InterpolatedValue;	
							//ttt[6] = ScaledValue;			
							
							break;
						}
					}
	}
	return ScaledValue;

}

int16_t Therm_GetTemp(int32_t  kohm, NTC_TYPE_T type)
{
	int16_t ret_value= 0;
	//int16_t temp;
	
	switch(type)
	{
		case NTC_5K_B3324:
			//ret_value= Therm_GetTemperature_NTC_Table(kohm, Therm_5K_B3324);  
		  ret_value= SensorOhmsToTemperature_5K_B3324(kohm);
			break;
		case NTC_10K_B3950:
			   //ret_value= Therm_GetTemperature_NTC_Table(kohm, Therm_10K_B3950);
		     //ret_value= SensorOhmsToTemperature_10K_B3950(kohm);
		      ret_value= 0;
			   break;
		case NTC_50K_B3950:
			//ret_value= Therm_GetTemperature_NTC_Table(kohm, Therm_50K_B3950);
		   ret_value= SensorOhmsToTemperature_50K_B3950(kohm);
			break;
			
		case NTC_5K_A501440:
			//ret_value= Therm_GetTemperature_NTC_Table(kohm, Therm_5K_A501440);
		    ret_value= SensorOhmsToTemperature_5K_A501440(kohm);
			break;
		case NTC_5K_A501436:
			//ret_value= Therm_GetTemperature_NTC_Table(kohm, Therm_5K_A501436);
		   ret_value= SensorOhmsToTemperature_5K_A501436(kohm);
			break;
    case NTC_50K_B3970:
			//ret_value= Therm_GetTemperature_NTC_Table(kohm, Therm_50K_B3970);
		    ret_value= SensorOhmsToTemperature_50K_B3970(kohm);
			break;
		case NTC_15K_B3450:
			ret_value= SensorOhmsToTemperature_15K_B3450(kohm);
			break;
		default:
			break;
	}
	
//	temp= ret_value*10;
//	ret_value= temp;
//	ret_value/= 10;
	
	return ret_value;
}

float Temp_F2C(float temp)
{
	return (temp*9.0f/5.0f + 32.0f);
}

float Temp_C2F(float temp)
{
	return ((temp - 32.0f)*5.0f/9.0f);
}
